﻿using UnityEngine;
using System;

namespace MYSTARFORCE
{
    /// <summary>
    /// 可作为目标的实体类
    /// </summary>
    [Serializable]
    public abstract class TargetableObjectData : EntityData
    {

        [SerializeField]
        private int m_Hp = 0;

        /// <summary>
        /// 实体所属阵营
        /// </summary>
        /// 
        [SerializeField]
        private CampType m_Camp = CampType.Unknow;

        public CampType Camp
        {
            get
            {
                return m_Camp;
            }
        }

        /// <summary>
        /// 当前生命值
        /// </summary>
        public int HP
        {
            get
            {
                return m_Hp;
            }
            set
            {
                m_Hp = value;
            }
        }

        /// <summary>
        /// 最大生命值
        /// </summary>
        public abstract int MaxHp
        {
            get;
        }

        /// <summary>
        /// 生命百分比
        /// </summary>
        public float HPRatio
        {
            get
            {
                return MaxHp > 0 ? (float)HP / MaxHp : 0f;
            }
        }
        public TargetableObjectData(int entityId, int typeId, CampType camp) : base(entityId, typeId)
        {

            m_Camp = camp;
            m_Hp = 0;
        }
    }
}